#!/bin/bash
# 激活Python虚拟环境脚本

# 检查是否在虚拟环境中
if [ -z "$VIRTUAL_ENV" ]; then
    # 检查虚拟环境目录是否存在
    if [ -d "/Users/caohongjun/workspace/crawler/venv" ]; then
        echo "正在激活虚拟环境..."
        source /Users/caohongjun/workspace/crawler/venv/bin/activate
        echo "虚拟环境已激活"
    else
        echo "错误: 虚拟环境目录不存在"
        echo "请先在项目目录下创建虚拟环境: python -m venv venv"
    fi
else
    echo "虚拟环境已经激活: $VIRTUAL_ENV"
fi
